package org.ant.properties;

import org.dom4j.DocumentHelper;
import org.dom4j.Element;

public class DefaultProperty implements Property {

	public static final String VALUE = "value";

	private String key;
	private Object value;

	public DefaultProperty() {

	}

	public void setValue(Object value) {
		this.value = value;
	}

	public String getValue() {
		return value.toString();
	}

	public String getKey() {
		return key;
	}

	public Element getElement() {
		Element element = DocumentHelper.createElement(VALUE);
		element.addText(value.toString());
		return element;
	}

	public void init(Element element) {
		key = element.element(PropertyManager.KEY).getText();
		value = element.element(VALUE).getText();
	}
}
